import React from 'react';
//1. 引入 Route, BrowserRouter组件  <nav>
import { Route, NavLink, Switch } from 'react-router-dom';
import Home from './pages/Home';
import About from './pages/About';
import News from './pages/News';
import Header from './pages/Header';
import MyNavLink from './components/MyNavLink';
// import "./App.css";

//创建根组件 App
export default class App extends React.Component {
    render() {
        return (<div>
            <div className="row">
                <div className="col-xs-offset-2 col-xs-8">
                    <div className="page-header">
                        <h2>React Router Demo</h2>
                    </div>
                </div>
            </div>
            <div className="row">
                <div className="col-xs-2 col-xs-offset-2">
                    <div className="list-group">
                        <NavLink to="/home" className="list-group-item">HOME</NavLink>
                        <NavLink to="/about" className="list-group-item">ABOUT</NavLink>
                    </div>
                </div>
                <div className="col-xs-6">
                    <Switch>
                        <Route  path="/home" component={Home} />
                        <Route  path="/about" component={About} />
                    </Switch>

                </div>
            </div>
        </div>);
    }
}



